//
//  XD_RecommendCollViewCell.swift
//  XueDao
//
//  Created by wenwen on 2021/3/6.
//

import UIKit

class XD_RecommendCollViewCell: UICollectionViewCell {
    
    lazy var titleLab: UILabel = {
        let titleLab = UILabel()
        titleLab.numberOfLines = 2
        titleLab.textAlignment = .left
        titleLab.font = .xsFont(name: .medium, .scale * 14)
        titleLab.textColor = UIColor(red: 0.22, green: 0.24, blue: 0.25, alpha: 1.0)
        
        return titleLab
    }()
    
    lazy var detailLab: UILabel = {
        let detailLab = UILabel()
        detailLab.numberOfLines = 1
        detailLab.textAlignment = .left
        detailLab.font = .xsFont(name: .regular, .scale * 12)
        detailLab.textColor = UIColor(red: 0.45, green: 0.47, blue: 0.49, alpha: 1.0)
        
        return detailLab
    }()
    
    lazy var iconImgV: UIImageView = {
        let iconImgV = UIImageView()
        iconImgV.contentMode = .scaleAspectFill
        iconImgV.layer.masksToBounds = true
        iconImgV.layer.cornerRadius = .scale * 4
        return iconImgV
    }()
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        layer.masksToBounds = true
        layer.cornerRadius = .scale * 4
        backgroundColor =  UIColor(red: 0.97, green: 0.97, blue: 0.97, alpha: 1.0)
        
        contentView.addSubview(iconImgV)
        iconImgV.snp.makeConstraints { (make) in
            make.top.equalTo(.scale * 12)
            make.right.bottom.equalTo(-.scale * 12)
            make.width.equalTo(.scale * 88)
        }
        
        contentView.addSubview(titleLab)
        titleLab.snp.makeConstraints { (make) in
            make.top.left.equalTo(.scale * 12).priority(.high)
            make.right.equalTo(iconImgV.snp.left).offset(-.scale * 8)
        }
        
        contentView.addSubview(detailLab)
        detailLab.snp.makeConstraints { (make) in
            make.top.greaterThanOrEqualTo(titleLab.snp.bottom).offset(.scale * 8)
            make.left.equalTo(.scale * 12)
            make.bottom.equalTo(-.scale * 12).priority(.high)
            make.right.equalTo(titleLab)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
}
